import request from '@/config/axios'

// 会员积分规则配置 VO
export interface PointRuleConfigVO {
  id: number // 主键
  name: string // 规则名称
  detail: string // 规则明细
  status: number // 状态
  radio: number // 获取积分比例
  validDays: number // 积分有效期
  expireRemindDays: string // 有效期提醒
}

// 会员积分规则配置 API
export const PointRuleConfigApi = {
  // 查询会员积分规则配置分页
  getPointRuleConfigPage: async (params: any) => {
    return await request.get({ url: `/member/point-rule-config/page`, params })
  },

  // 查询会员积分规则配置详情
  getPointRuleConfig: async (id: number) => {
    return await request.get({ url: `/member/point-rule-config/get?id=` + id })
  },

  // 新增会员积分规则配置
  createPointRuleConfig: async (data: PointRuleConfigVO) => {
    return await request.post({ url: `/member/point-rule-config/create`, data })
  },

  // 修改会员积分规则配置
  updatePointRuleConfig: async (data: PointRuleConfigVO) => {
    return await request.put({ url: `/member/point-rule-config/update`, data })
  },

  // 删除会员积分规则配置
  deletePointRuleConfig: async (id: number) => {
    return await request.delete({ url: `/member/point-rule-config/delete?id=` + id })
  },

  // 导出会员积分规则配置 Excel
  exportPointRuleConfig: async (params) => {
    return await request.download({ url: `/member/point-rule-config/export-excel`, params })
  },
}